#!/bin/bash
oasis_file=$1
spi_file=$2
top_name=`exec drvTopcell ${oasis_file}`

echo "LAYOUT PATH '${oasis_file}'"  >   ./xact.rule
echo "LAYOUT SYSTEM OASIS"        >>  ./xact.rule
echo "LAYOUT PRIMARY ${top_name}" >>  ./xact.rule
echo "SOURCE PATH '${spi_file}'"    >>  ./xact.rule
echo "SOURCE SYSTEM SPICE"        >>  ./xact.rule
echo "SOURCE PRIMARY ${top_name}" >>  ./xact.rule


##### setting #####
echo "PEX FIELDSOLVER MODE 200"   >>  ./xact.rule
echo "PEX NETLIST \"${top_name}.pex.netlist\" DSPF SOURCENAMES" >>  ./xact.rule
echo "MASK SVDB DIRECTORY \"svdb\" QUERY XACT" >> ./xact.rule
echo "PEX XACT PDB YES" >> ./xact.rule
echo "LVS REPORT \"lvs.report\"" >> ./xact.rule
#echo "VIRTUAL CONNECT NAME \"?VDD?\" \"?VSS?\" \"?GND?\" \"VDD??\" \"VSUB\" \"VPP\" \"VBB\"" >> ./xact.rule
echo "LVS POWER NAME \"VPP\" \"VDD??\" \"?VDD?\"" >> ./xact.rule
echo "LVS GROUND NAME \"VBB\" \"?GND?\" \"?VSS?\"" >> ./xact.rule
echo "LVS RECOGNIZE GATES NONE" >> ./xact.rule
echo "LVS FILTER UNUSED OPTION NONE SOURCE" >> ./xact.rule
echo "LVS FILTER UNUSED OPTION NONE LAYOUT" >> ./xact.rule
echo "LVS REPORT OPTION S" >> ./xact.rule
echo "DRC ICSTATION YES" >> ./xact.rule
#echo "LAYOUT RENAME TEXT \"_\\[_<_g\" \"_\\]_>_g\"" >> ./xact.rule
echo "INCLUDE \"/projects/analog_ip/workspace/xwqiu/cl/tacoma6/verify/xACT/rule/xact.rule.typical\"" >> ./xact.rule
echo "LVS BOX DLY_LINE_512"             >> ./xact.rule
echo "LVS BOX DLY_LINE_1024_MAT"        >> ./xact.rule


##### run #####
/apps/mentor/aoi_cal_2021.2_28.15/bin/calibre -lvs -hier -turbo -turbo_all -nowait ./xact.rule | tee ./lvs.log
/apps/mentor/aoi_cal_2021.2_28.15/bin/calibre -xact -3d -rcc -turbo -turbo_all ./xact.rule | tee ./xact.log